package com.www.conversionspring.converters;

import com.www.conversionspring.beans.Computer;
import com.www.conversionspring.beans.Mobile;
import org.springframework.beans.BeanUtils;
import org.springframework.core.convert.ConversionService;
import org.springframework.core.convert.converter.Converter;

/**
 * <p>
 *         手机-电脑     转换器
 * </p>
 *
 * @author Zed.Yun
 * @Title: ComputerMobileConverter
 * @ProjectName conversion-spring
 * @date 2019/3/18 13:29
 */
public class ComputerMobileConverter implements Converter<Mobile, Computer> {

    @Override
    public Computer convert(Mobile source) {
        Computer computer = null;
        if(Mobile.class.isInstance(source)){
            computer = new Computer();
            BeanUtils.copyProperties(source,computer);
        }
        return computer;
    }



}
